/*
 * keyhal.h
 *
 * Created: 8/16/2013 2:47:54 PM
 *  Author: Ken Arok
 *
 * \brief Hardware Abstraction Layer of Keypad Interface.
 *
 * Copyright (c) 2013 PT Hanindo Automation Solutions. All rights reserved.
 *
 */

#include "config_board.h"

#if BOARD_1_0_USED

#ifndef KEY_HAL_H_
#define KEY_HAL_H_

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif


/** \brief Disable key interrupt.
 */
extern void key_disable(void);

/** \brief Enable key interrupt.
 */
extern void key_enable(void);

/** \brief Initialize keypad interface.
 */
extern void key_init(void);

/** \brief Get 16 bit key pressed representation.
 *
 * \return KEYWORD		16 bit key representative of pressed button.
 *
 */
extern uint16_t key_get_word(void);

/** \brief Get character of key pressed representation.
 *
 * \return KEYCHAR		Character of key pressed representation.
 *
 */
extern char key_get_char(void);

/** \brief Get 16 bit of key pressed representation for combination key.
 *
 * \return KEYCOMBINE		16 bit of key pressed representation.
 *
 */
extern uint16_t key_get_combine(void);

/** \brief Wait until one of the wanted characters of keypad is pressed.
 *
 * \param	_keychar		Pointer to the string of waited characters.
 *
 * \return Status
 *	\retval 0			Failed
 *	\retval Keychar		Character of pressed key.
 *
 */
extern char key_wait_keychar(const char *_keychar);

/** \brief Wait the keypad until it is released.
 */
extern void key_wait_release(void);


#ifdef __cplusplus
}
#endif

#endif /* KEY_HAL_H_ */

#endif /* BOARD_1_0_USED */
